Skip to content

Add MaxRequestSize option to OTLP exporters#8157

Merged
pellared merged 1 commit intoopen-telemetry:mainfrom
pellared:otlp-req-size
Apr 23, 2026
Merged

Add MaxRequestSize option to OTLP exporters#8157
pellared merged 1 commit intoopen-telemetry:mainfrom
pellared:otlp-req-size

Conversation

@pellared
Copy link
Copy Markdown
Member

@pellared pellared commented Apr 8, 2026

Per and blocked by: open-telemetry/opentelemetry-proto#782

  • Introduced WithMaxRequestSize option for OTLP exporters to set a limit on the size of serialized export requests.
  • Implemented logic in the HTTP and gRPC clients to check the request size against the configured maximum before compression and sending.
  • The default configuration is that the maximum request size is 32 MiB.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2026

Codecov Report

❌ Patch coverage is 98.52941% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.9%. Comparing base (760898d) to head (27f503a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
exporters/otlp/otlplog/otlploghttp/client.go 80.0% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #8157   +/-   ##
=====================================
  Coverage   82.8%   82.9%           
=====================================
  Files        314     314           
  Lines      24828   24896   +68     
=====================================
+ Hits       20575   20643   +68     
  Misses      3880    3880           
  Partials     373     373           
Files with missing lines Coverage Δ
exporters/otlp/otlplog/otlploggrpc/client.go 95.7% <100.0%> (+1.7%) ⬆️
exporters/otlp/otlplog/otlploggrpc/config.go 92.8% <100.0%> (+0.2%) ⬆️
exporters/otlp/otlplog/otlploghttp/config.go 94.2% <100.0%> (+0.1%) ⬆️
exporters/otlp/otlpmetric/otlpmetricgrpc/client.go 92.7% <100.0%> (+0.2%) ⬆️
exporters/otlp/otlpmetric/otlpmetricgrpc/config.go 45.6% <100.0%> (+1.9%) ⬆️
...tlpmetric/otlpmetricgrpc/internal/oconf/options.go 90.2% <100.0%> (+0.4%) ⬆️
exporters/otlp/otlpmetric/otlpmetrichttp/client.go 87.1% <100.0%> (+0.2%) ⬆️
exporters/otlp/otlpmetric/otlpmetrichttp/config.go 88.5% <100.0%> (+0.6%) ⬆️
...tlpmetric/otlpmetrichttp/internal/oconf/options.go 93.2% <100.0%> (+0.2%) ⬆️
exporters/otlp/otlptrace/otlptracegrpc/client.go 91.2% <100.0%> (+0.2%) ⬆️
... and 6 more

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a configurable maximum request size for OTLP exporters (traces, metrics, logs) and enforces it in both HTTP and gRPC clients to fail oversized exports early. The default maximum request size is set to 32 MiB (applies to serialized payload size before compression).

Changes:

  • Introduce WithMaxRequestSize option across OTLP trace/metric/log exporters and plumb it through configs.
  • Enforce max request size checks in HTTP (byte length of marshaled request) and gRPC (protobuf encoded size) clients before sending.
  • Add unit tests verifying default behavior and that oversized requests fail before any network call.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/shared/otlp/otlptrace/otlpconfig/options.go.tmpl Adds DefaultMaxRequestSize and MaxRequestSize to trace shared config + option wiring.
internal/shared/otlp/otlptrace/otlpconfig/options_test.go.tmpl Tests default and WithMaxRequestSize behavior for shared trace config.
internal/shared/otlp/otlpmetric/oconf/options.go.tmpl Adds DefaultMaxRequestSize and MaxRequestSize to metric shared config + option wiring.
internal/shared/otlp/otlpmetric/oconf/options_test.go.tmpl Tests default and WithMaxRequestSize behavior for shared metric config.
exporters/otlp/otlptrace/otlptracehttp/options.go Exposes WithMaxRequestSize on the OTLP trace HTTP exporter options.
exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options.go Adds default max request size + config field + option wiring for trace HTTP exporter internals.
exporters/otlp/otlptrace/otlptracehttp/internal/otlpconfig/options_test.go Tests default and WithMaxRequestSize behavior for trace HTTP internal config.
exporters/otlp/otlptrace/otlptracehttp/client.go Enforces max request size for HTTP trace exports before sending.
exporters/otlp/otlptrace/otlptracehttp/client_test.go Adds test to ensure oversized HTTP trace requests fail before any request is sent.
exporters/otlp/otlptrace/otlptracegrpc/options.go Exposes WithMaxRequestSize on the OTLP trace gRPC exporter options.
exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options.go Adds default max request size + config field + option wiring for trace gRPC exporter internals.
exporters/otlp/otlptrace/otlptracegrpc/internal/otlpconfig/options_test.go Tests default and WithMaxRequestSize behavior for trace gRPC internal config.
exporters/otlp/otlptrace/otlptracegrpc/client.go Enforces max request size for gRPC trace exports before calling Export.
exporters/otlp/otlptrace/otlptracegrpc/client_test.go Adds test to ensure oversized gRPC trace requests fail before reaching the collector.
exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options.go Adds default max request size + config field + option wiring for metric HTTP exporter internals.
exporters/otlp/otlpmetric/otlpmetrichttp/internal/oconf/options_test.go Tests default and WithMaxRequestSize behavior for metric HTTP internal config.
exporters/otlp/otlpmetric/otlpmetrichttp/config.go Exposes WithMaxRequestSize on the OTLP metric HTTP exporter options.
exporters/otlp/otlpmetric/otlpmetrichttp/client.go Enforces max request size for HTTP metric exports before sending.
exporters/otlp/otlpmetric/otlpmetrichttp/client_test.go Adds test to ensure oversized HTTP metric requests fail before any request is sent.
exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options.go Adds default max request size + config field + option wiring for metric gRPC exporter internals.
exporters/otlp/otlpmetric/otlpmetricgrpc/internal/oconf/options_test.go Tests default and WithMaxRequestSize behavior for metric gRPC internal config.
exporters/otlp/otlpmetric/otlpmetricgrpc/config.go Exposes WithMaxRequestSize on the OTLP metric gRPC exporter options.
exporters/otlp/otlpmetric/otlpmetricgrpc/client.go Enforces max request size for gRPC metric exports before calling Export.
exporters/otlp/otlpmetric/otlpmetricgrpc/client_test.go Adds test to ensure oversized gRPC metric requests fail before reaching the collector.
exporters/otlp/otlplog/otlploghttp/config.go Adds max request size to log HTTP exporter config, defaulting to 32 MiB, and exposes WithMaxRequestSize.
exporters/otlp/otlplog/otlploghttp/config_test.go Updates config tests to cover default and explicit max request size settings.
exporters/otlp/otlplog/otlploghttp/client.go Enforces max request size for HTTP log exports before sending.
exporters/otlp/otlplog/otlploghttp/client_test.go Adds test to ensure oversized HTTP log requests fail before any request is sent.
exporters/otlp/otlplog/otlploggrpc/config.go Adds max request size to log gRPC exporter config, defaulting to 32 MiB, and exposes WithMaxRequestSize.
exporters/otlp/otlplog/otlploggrpc/config_test.go Updates config tests to cover default and explicit max request size settings.
exporters/otlp/otlplog/otlploggrpc/client.go Enforces max request size for gRPC log exports before calling Export.
exporters/otlp/otlplog/otlploggrpc/client_test.go Adds test to ensure oversized gRPC log requests fail before sending.
CHANGELOG.md Documents the new option and the default 32 MiB request size limit behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread exporters/otlp/otlptrace/otlptracehttp/client.go Outdated
@pellared pellared marked this pull request as ready for review April 8, 2026 16:05
Comment thread exporters/otlp/otlplog/otlploggrpc/client.go
Comment thread exporters/otlp/otlptrace/otlptracehttp/options.go
Comment thread exporters/otlp/otlplog/otlploggrpc/config.go
Copy link
Copy Markdown
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just nits and questions for my own education

Comment thread exporters/otlp/otlplog/otlploghttp/client.go Outdated
@MrAlias MrAlias added this to the v1.44.0 milestone Apr 23, 2026
@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla Bot commented Apr 23, 2026

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: pellared / name: Robert Pajak (27f503a)

@pellared pellared marked this pull request as draft April 23, 2026 19:35
…mit on the size of serialized export requests.

- Implemented logic in the HTTP and gRPC clients to check the request size against the configured maximum before compression and sending.
- The default configuration is that the maximum request size is 32 MiB.
@pellared pellared marked this pull request as ready for review April 23, 2026 20:01
@pellared
Copy link
Copy Markdown
Member Author

SIG meeting:
Merging as it is more likely that the limit in the spec will be larger than 32 MiB, but certainly not smaller.

@pellared pellared merged commit b4e15cd into open-telemetry:main Apr 23, 2026
33 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants